﻿Public Class topdown
    Dim otherTB As Object
    Private Sub topdown_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim x As Integer
        Dim y As Integer
        x = Screen.PrimaryScreen.WorkingArea.Height
        y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

        Do Until x = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
            x = x - 1
            Me.Location = New Point(x)
        Loop

       
        x = Screen.PrimaryScreen.WorkingArea.Width
        y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

        Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
            x = x - 1
            Me.Location = New Point(x)
        Loop
        'Select Case My.Computer.Clock.LocalTime.DayOfWeek
        '    Case 1
        '        dayBox.Text = "Monday"
        '    Case 2
        '        dayBox.Text = "Tuesday"
        '    Case 3
        '        dayBox.Text = "Wednesday"
        '    Case 4
        '        dayBox.Text = "Thursday"
        '    Case 5
        '        dayBox.Text = "Friday"
        '    Case Else
        '        dayBox.Text = "Monday"
        'End Select
        Label42.Text = KHM.Main.Label42.Text
    End Sub

    Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub m1_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub dayBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles dayBox.SelectedIndexChanged
        startData()
    End Sub
    Private Sub startData()
        loadData(getDay, getPer)
    End Sub
    Private Function getDay()
        Dim day As String
        day = dayBox.Text
        Return day
       
    End Function
    Private Function getPer()
        Dim classP As String
        Dim per As Integer
        classP = classBox.Text
        Select Case classP
            Case "Period 1"
                per = 1
            Case "Period 2"
                per = 2
            Case "Period 3"
                per = 3
            Case "Period 4"
                per = 4
            Case "Period 5"
                per = 5
            Case "Period 6"
                per = 6
            Case Else
                MsgBox("Select a valid class period.")

        End Select
        Return per
    End Function
    Private Function getWeekselect()
        Dim weekselect As String
        weekselect = Label42.Text
        Return weekselect
    End Function
    Private Sub loadData(day As String, period As Integer)

        If period = 1 And day = "Monday" Then
            tb.Text = KHM.Main.m1.Text

        End If
        If period = 2 And day = "Monday" Then
            tb.Text = KHM.Main.m2.Text

        End If
        If period = 3 And day = "Monday" Then
            tb.Text = KHM.Main.m3.Text

        End If
        If period = 4 And day = "Monday" Then
            tb.Text = KHM.Main.m4.Text

        End If
        If period = 5 And day = "Monday" Then
            tb.Text = KHM.Main.m5.Text

        End If
        If period = 6 And day = "Monday" Then
            tb.Text = KHM.Main.m6.Text

        End If
        'Tuesday
        If period = 1 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu1.Text

        End If
        If period = 2 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu2.Text

        End If
        If period = 3 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu3.Text

        End If
        If period = 4 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu4.Text

        End If
        If period = 5 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu5.Text

        End If
        If period = 6 And day = "Tuesday" Then
            tb.Text = KHM.Main.tu6.Text

        End If
        'Wednesday
        If period = 1 And day = "Wednesday" Then
            tb.Text = KHM.Main.w1.Text

        End If
        If period = 2 And day = "Wednesday" Then
            tb.Text = KHM.Main.w2.Text

        End If
        If period = 3 And day = "Wednesday" Then
            tb.Text = KHM.Main.w3.Text

        End If
        If period = 4 And day = "Wednesday" Then
            tb.Text = KHM.Main.w4.Text

        End If
        If period = 5 And day = "Wednesday" Then
            tb.Text = KHM.Main.w5.Text

        End If
        If period = 6 And day = "Wednesday" Then
            tb.Text = KHM.Main.w6.Text

        End If
        'Thursday
        If period = 1 And day = "Thursday" Then
            tb.Text = KHM.Main.tr1.Text

        End If
        If period = 2 And day = "Thursday" Then
            tb.Text = KHM.Main.tr2.Text

        End If
        If period = 3 And day = "Thursday" Then
            tb.Text = KHM.Main.tr3.Text

        End If
        If period = 4 And day = "Thursday" Then
            tb.Text = KHM.Main.tr4.Text

        End If
        If period = 5 And day = "Thursday" Then
            tb.Text = KHM.Main.tr5.Text

        End If
        If period = 6 And day = "Thursday" Then
            tb.Text = KHM.Main.tr6.Text

        End If
        'Friday
        If period = 1 And day = "Friday" Then
            tb.Text = KHM.Main.f1.Text

        End If
        If period = 2 And day = "Friday" Then
            tb.Text = KHM.Main.f2.Text

        End If
        If period = 3 And day = "Friday" Then
            tb.Text = KHM.Main.f3.Text

        End If
        If period = 4 And day = "Friday" Then
            tb.Text = KHM.Main.f4.Text

        End If
        If period = 5 And day = "Friday" Then
            tb.Text = KHM.Main.f5.Text

        End If
        If period = 6 And day = "Friday" Then
            tb.Text = KHM.Main.f6.Text

        End If
    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
        sendEverything(getPer, getDay, tb.Text)
        KHM.Main.save()

    End Sub
    Private Sub sendEverything(period As Integer, Day As String, text As String)
        If period = 1 And Day = "Monday" Then
            KHM.Main.writem1(getWeekselect, text)

        End If
        If period = 2 And Day = "Monday" Then
            KHM.Main.writem2(getWeekselect, text)

        End If
        If period = 3 And Day = "Monday" Then
            KHM.Main.writem3(getWeekselect, text)

        End If
        If period = 4 And Day = "Monday" Then
            KHM.Main.writem4(getWeekselect, text)
        End If
        If period = 5 And Day = "Monday" Then
            KHM.Main.writem5(getWeekselect, text)

        End If
        If period = 6 And Day = "Monday" Then
            KHM.Main.writem6(getWeekselect, text)

        End If
        'Tuesday
        If period = 1 And Day = "Tuesday" Then
            KHM.Main.writetu1(getWeekselect, text)

        End If
        If period = 2 And Day = "Tuesday" Then
            KHM.Main.writetu2(getWeekselect, text)

        End If
        If period = 3 And Day = "Tuesday" Then
            KHM.Main.writetu3(getWeekselect, text)

        End If
        If period = 4 And Day = "Tuesday" Then
            KHM.Main.writetu4(getWeekselect, text)

        End If
        If period = 5 And Day = "Tuesday" Then
            KHM.Main.writetu5(getWeekselect, text)

        End If
        If period = 6 And Day = "Tuesday" Then
            KHM.Main.writetu6(getWeekselect, text)

        End If
        'Wednesday
        If period = 1 And Day = "Wednesday" Then
            KHM.Main.writew1(getWeekselect, text)

        End If
        If period = 2 And Day = "Wednesday" Then
            KHM.Main.writew2(getWeekselect, text)

        End If
        If period = 3 And Day = "Wednesday" Then
            KHM.Main.writew3(getWeekselect, text)

        End If
        If period = 4 And Day = "Wednesday" Then
            KHM.Main.writew4(getWeekselect, text)

        End If
        If period = 5 And Day = "Wednesday" Then
            KHM.Main.writew5(getWeekselect, text)

        End If
        If period = 6 And Day = "Wednesday" Then
            KHM.Main.writew6(getWeekselect, text)

        End If
        'Thursday
        If period = 1 And Day = "Thursday" Then
            KHM.Main.writetr1(getWeekselect, text)

        End If
        If period = 2 And Day = "Thursday" Then
            KHM.Main.writetr2(getWeekselect, text)

        End If
        If period = 3 And Day = "Thursday" Then
            KHM.Main.writetr3(getWeekselect, text)

        End If
        If period = 4 And Day = "Thursday" Then
            KHM.Main.writetr4(getWeekselect, text)

        End If
        If period = 5 And Day = "Thursday" Then
            KHM.Main.writetr5(getWeekselect, text)

        End If
        If period = 6 And Day = "Thursday" Then
            KHM.Main.writetr6(getWeekselect, text)

        End If
        'Friday
        If period = 1 And Day = "Friday" Then
            KHM.Main.writef1(getWeekselect, text)

        End If
        If period = 2 And Day = "Friday" Then
            KHM.Main.writef2(getWeekselect, text)

        End If
        If period = 3 And Day = "Friday" Then
            KHM.Main.writef3(getWeekselect, text)

        End If
        If period = 4 And Day = "Friday" Then
            KHM.Main.writef4(getWeekselect, text)

        End If
        If period = 5 And Day = "Friday" Then
            KHM.Main.writef5(getWeekselect, text)

        End If
        If period = 6 And Day = "Friday" Then
            KHM.Main.writef6(getWeekselect, text)

        End If
        KHM.Main.reload(saveB:=False)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        KHM.sidebar.topdownHideShow()
    End Sub
End Class
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.

'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>